package cn.njxzc.examples;

public class Exam6_5

{

	static void fun1(int i) throws ArithmeticException

	{

		System.out.println("���÷���:fun1(" + i + ")");

		if (i == 0)

		{

			System.out.println("û���쳣����n");

		}

		else if (i == 1)

		{

			int a = 0;

			int b = 10;

			b /= a;

			ArithmeticException e = new ArithmeticException();

			throw e;

		}

	}

	static void fun2() throws ArrayIndexOutOfBoundsException

	{

		System.out.println("���÷���:fun2()");

		int m[] = new int[5];

		m[5] = 100;

		ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException();

		throw e;

	}

	static void fun3() throws NumberFormatException

	{

		System.out.println("���÷���:fun3()");

		String str = "56k9";

		int n = Integer.parseInt(str);

		NumberFormatException e = new NumberFormatException();

		throw e;

	}

	public static void main(String[] args)

	{

		try

		{

			fun1(0);

			fun1(1);

		}

		catch (ArithmeticException e)

		{

			System.out.println("��t��׽�쳣:" + e.getMessage() + "��");

		}

		try

		{
			fun2();
		}

		catch (ArrayIndexOutOfBoundsException e)

		{

			System.out.println("��t��׽�쳣:" + e + "��n");

		}

		try

		{
			fun3();
		}

		catch (NumberFormatException e)

		{

			System.out.println("��t��׽�쳣:" + e);

		}

		finally

		{

			System.out.println("������ϣ���n");

		}

	}

}